<?php
declare (strict_types = 1);

namespace app\lib;

class Num {

    /**
     *  验证码
     * @param int $length
     * @return int
     */
    public static function getCode(int $length = 4) :int {
        if ($length == 6) {
            $code = rand(100000, 999999);
        }

        return rand(1000, 9999);
    }
}